package com.firstDay;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Demo02 {
    public static void main(String[] args) {

        // double test1 = 10.0;
        // double test2 = 15.2;
        // double sum = test1 + test2;
        // System.out.println(sum);

        LocalDate now = LocalDate.now();
        // 获取当月的第一天并转换为字符串
        LocalDate firstDayOfMonth = now.withDayOfMonth(1);
        String firstDayOfMonthStr = firstDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        System.out.println("当月第一天的日期:" + firstDayOfMonthStr);

        // 获取当月的最后一天并转换为字符串
        LocalDate lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth());
        String lastDayOfMonthStr = lastDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        System.out.println("当月最后一天的日期:" + lastDayOfMonthStr);

    }
}
